const { defineConfig } = require("@vue/cli-service");
// 设置element plus按需引入
const AutoImport = require("unplugin-auto-import/webpack");
const Components = require("unplugin-vue-components/webpack");
const { ElementPlusResolver } = require("unplugin-vue-components/resolvers");

const UnoCSS = require('@unocss/webpack').default;

module.exports = defineConfig({
  transpileDependencies: true,
  //注意plugins放在外面会报错，必须加上configureWebpack
  configureWebpack: {
    plugins: [
      // 报错AutoImport is not a function是因为版本太高，降低到npm install unplugin-auto-import@0.16.1 这个版本就解决了
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
      UnoCSS({}),
    ],
  },
});
